home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume10 / multitalk < prev    next >
Encoding:
Text File  |  1990-02-13  |  52.2 KB  |  1,740 lines

  1. Newsgroups: comp.sources.misc
  2. From: Al Viall <al@questar.questar.mn.org>
  3. Subject: v10i069: MultiTalk1.2 - Multi-user Talk Parlour
  4. Reply-To: Al Viall <uunet.uu.net!questar!al@tektronix.TEK.COM>
  5. Organization: Questar Data Systems, Inc., St. Paul, MN
  6. Sender: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  7.  
  8. Posting-number: Volume 10, Issue 69
  9. Submitted-by: Al Viall <al@questar.questar.mn.org>
  10. Archive-name: multitalk
  11.  
  12.  Multitalk is a multi-user talk program which allows up to 20 users
  13. online at one time. For BSD and System V machines only.
  14. -----------------------  Cut here, then type sh 'file' --------------------
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of shell archive."
  22. # Contents:  Readme.1st cmds.txt mtalk.1 mtalk.man multitalk.c
  23. #   multitalk.h news.txt
  24. # Wrapped by al@hobbes on Thu Feb  8 15:11:16 1990
  25. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  26. if test -f Readme.1st -a "${1}" != "-c" ; then 
  27.   echo shar: Will not over-write existing file \"Readme.1st\"
  28. else
  29. echo shar: Extracting \"Readme.1st\" \(5104 characters\)
  30. sed "s/^X//" >Readme.1st <<'END_OF_Readme.1st'
  31. X                    Helpfull hints from the Author
  32. XHello, if you are reading this right now, then obviously you have decided to
  33. Xtry out the enclosed program, Multitalk. Henceforth, the words Mtalk and
  34. XMultiTalk will conversely mean the same thing.
  35. XI'll try to keep this as brief as possible, since the purpose of me writing
  36. Xthis was only to point out certain things which may be helpfull in maintaining
  37. XMtalk, but most of the comments included with the source are pretty self-
  38. Xexplanatory.
  39. X
  40. XPURPOSE
  41. X    The purpose behind writing Multitalk was actually two-fold. I needed
  42. Xa project to do in my spare time in order to understand and write in 'C', and
  43. XI thought that this type of a program would be rather usefull and entertaining
  44. Xon BSD systems which only had TALK or NTALK to interactively converse with 
  45. Xothers on the system. Mtalk does not have the limitation of ONE to ONE chatting
  46. Xlike TALK or NTALK (These programs are ussually supplied with BSD systems), but
  47. Xcan have up to 20 users online at once. Mtalk also allows private conversation
  48. Xbetween individuals or groups(sitting at a table). Mtalk was very easy to
  49. Xwrite after the initial things were out of the way, so I decided to make it
  50. Xeasy for others to use. No object modules. No Makefile's. Just a simple script
  51. Xthat will compile and then if successful, will setuid the executable so that
  52. Xothers may use it.
  53. X
  54. XINSTALLATION
  55. X    Installation requires a few steps, none of which should take very
  56. Xlong to accomplish.
  57. X
  58. X    Step 1: Decide where you would like Mtalk to reside. Make that directory
  59. X    read/write/execute for the person in charge of Mtalk. From this point on
  60. X    we shall assume it is you. The reason for this, is that we wouldn't
  61. X    want unwanted visitors into the directory since Mtalk has certain
  62. X    security functions for users who abuse it. Those people would just end
  63. X    up mucking things all to hell.
  64. X
  65. X    Step 2: Put all of the enclosed files into that directory except for
  66. X    the /bin/sh script file called 'mtalk'. This file should be put into
  67. X    a default login directory like /usr/local/bin. Before you do that, 
  68. X    be sure to edit the script for the pathname to the Mtalk directory.
  69. X
  70. X    Step 3: Edit the multitalk.h file to correspond with the filenames 
  71. X    that you wish things to be. Be sure to specify a HEADMOO <--Don't Ask.
  72. X    Without a UID name for this definition, certain caretaker features can
  73. X    not be used by you. These features include tasklock and user removal.
  74. X
  75. X    Step 4: Now compile the multitalk.c file using the /bin/sh script
  76. X    'Makeit'. All this does is compile the source and then SETUID the
  77. X    executable file so that others can use it without Permission errors.
  78. X
  79. X    Step 5: Mtalk is now runnable. Too make sure, just type 'mtalk'.
  80. X
  81. X    I have not run into any errors or major bugs while using Mtalk. The
  82. Xonly problem so far is when someone ungracefully exits the program while in
  83. Xauto_mode(/AUTO). In this case, which is worst-case scenario, all you need
  84. Xto do, once you are told about it, is just edit the 'loginfile' and remove
  85. Xthat persons entry from the file. Also, you will want to remove that persons
  86. XPID-unique commfile.
  87. X
  88. XHOW IT WORKS
  89. X    As you may already know, when one runs a particular job or command
  90. Xin UNIX, the OS gives it a unique Process Identification Number(PID) so that
  91. Xit may be able to reference that number later.
  92. X    When you logon, Mtalk gets that PID number and a global variable is set
  93. Xto correspond to that number. This is now your personal CommFile. Each user
  94. Xwho logs on will get their own CommFile, which will be unique to that particular
  95. Xprocess, and the corresponding PID number is then written to the loginfile
  96. Xalong with other information pertinent to that user(i.e. UID_name, tty, etc.).
  97. X    When you input a line of text for others to see, the loginfile is loaded
  98. Xinto a structure array. Each entry is then taken, one by one, and your text is
  99. Xappended to that entry's CommFile. When the user/users that you sent the text
  100. Xto either hits C/R alone or uses a command AND there is text in their CommFile
  101. Xto display, then it is displayed. Mtalk is not a Parent Process dependent
  102. Xprogram. In other words, Mtalk does not start a parent process and spawn
  103. Xchildren whenever a new user executes the program. Doing it that way would
  104. Xhave been more work than it was worth!! Mtalk uses very little system resources,
  105. Xsince the  SIZE and RES, as reported by TOP is 134K and 38K, 
  106. Xrespectively.
  107. X
  108. XFINAL NOTES
  109. X    I hope this pretty much explains the naughty bits of Mtalk. I am
  110. Xsure you will either have good things to say about the program, are maybe you
  111. Xmight tell me where to put the thing, either way, I would like to hear about
  112. Xit. One serious note, I realize that more portable version of this would
  113. Xbe usefull to others, but considering the time involved, I just could not do
  114. Xit at this time, but it will be forthcoming. Right now, we only have the
  115. Xversion for BSD and System V.    If you have bug reports, and/or
  116. Xcriticisms and suggestions please read below.
  117. X
  118. X        Albert Viall
  119. X        6881 MeadowBrook Blvd #317
  120. X        St. Louis Park, MN 55426
  121. X
  122. X        E-Mail: al@{questar,hobbes}.QUESTAR.MN.ORG
  123. X        Voice : 1-612-688-0089 X42  (8:00am-5:00pm CST)
  124. X
  125. X
  126. X
  127. END_OF_Readme.1st
  128. if test 5104 -ne `wc -c <Readme.1st`; then
  129.     echo shar: \"Readme.1st\" unpacked with wrong size!
  130. fi
  131. # end of overwriting check
  132. fi
  133. if test -f cmds.txt -a "${1}" != "-c" ; then 
  134.   echo shar: Will not over-write existing file \"cmds.txt\"
  135. else
  136. echo shar: Extracting \"cmds.txt\" \(1506 characters\)
  137. sed "s/^X//" >cmds.txt <<'END_OF_cmds.txt'
  138. X
  139. XAvailable Commands as of: 1/11/90
  140. X
  141. X          Commands preceded by an '*' are for Caretaker use ONLY.
  142. X
  143. X /? .......... Displays this command help file.
  144. X /q .......... Quit. Logout of the Mtalk program.
  145. X /auto ....... Puts you in auto-mode. Constant 'returns' are not needed in this
  146. X           mode because Mtalk will wait until there is output to display.
  147. X*/broadcast .. Sends a highlighted message to all users.
  148. X*/dayfile .... Displays a dayfile of activity and users in Mtalk.
  149. X /echo ....... Toggles echo mode on/off.
  150. X /look ....... Tells you what table or room you are located.
  151. X*/lock ....... Puts the Mtalk program into a locked/unlocked state. This will
  152. X           prevent others from entering the Parlour.
  153. X /message .... Allows you to leave a short message for a user who is not logged
  154. X           on at the time. When that person logs on, it can be displayed.
  155. X /news ....... Displays any important bulletins or news if there is any to 
  156. X           report.
  157. X /page ....... Allows you to PAGE a user to Mtalk.
  158. X /prompt ..... Will change your default 'Say?' prompt to whatever you choose.
  159. X*/purge ...... Effectively bans a user from further use of Mtalk.
  160. X /sit ........ Moves you to whatever table of your choosing.
  161. X /status ..... Shows who is currently logged into Mtalk.
  162. X /time ....... Displays the current time and date.
  163. X /whisper .... Send a private message to someone anywhere in the Parlour.
  164. X /yell ....... Sends a message to everyone in the Parlour.
  165. X*/logoff ..... Forcibly logs off a current user of Mtalk.
  166. X
  167. X
  168. X
  169. END_OF_cmds.txt
  170. if test 1506 -ne `wc -c <cmds.txt`; then
  171.     echo shar: \"cmds.txt\" unpacked with wrong size!
  172. fi
  173. # end of overwriting check
  174. fi
  175. if test -f mtalk.1 -a "${1}" != "-c" ; then 
  176.   echo shar: Will not over-write existing file \"mtalk.1\"
  177. else
  178. echo shar: Extracting \"mtalk.1\" \(953 characters\)
  179. sed "s/^X//" >mtalk.1 <<'END_OF_mtalk.1'
  180. X.TH MTALK 1-Questar 
  181. X.SH NAME
  182. Xmtalk \- Multitalk multi-user Talk Parlour
  183. X.SH ORIGIN
  184. XQuestar Data Systems
  185. X.SH SYNOPSIS
  186. X.nf
  187. Xmtalk
  188. X.fi
  189. X.SH DESCRIPTION
  190. X.I mtalk 
  191. Xis a multi-user conference program which can support up to 20 users at
  192. Xthe same time. When you run
  193. X.I mtalk
  194. X, you actually run a shell script which then runs the main program and
  195. Xis controlled in the 
  196. X.I mtalk
  197. Xdirectory which is defined upon compilation. This program allows you to have
  198. Xeither public or private conversations with others who are logged into
  199. Xthe program at that particular time. For information on the many commands,
  200. Xand procedures for using
  201. X.I mtalk
  202. X, refer to you site administrator for copies of the manual.
  203. X.nf
  204. X.SH FILES
  205. X/usr/local/bin/mtalk - script that runs multitalk.
  206. X.SH BUGS
  207. X.I mtalk
  208. Xwill lose track of its loginfile if someone ctrl-C's out while in /auto. Other
  209. Xthan that, the program is bulletproof.
  210. X.SH AUTHOR
  211. XAlbert Viall
  212. X.\"    @(#)multitalk.c  2.0 (Questar)  8/9/89
  213. END_OF_mtalk.1
  214. if test 953 -ne `wc -c <mtalk.1`; then
  215.     echo shar: \"mtalk.1\" unpacked with wrong size!
  216. fi
  217. # end of overwriting check
  218. fi
  219. if test -f mtalk.man -a "${1}" != "-c" ; then 
  220.   echo shar: Will not over-write existing file \"mtalk.man\"
  221. else
  222. echo shar: Extracting \"mtalk.man\" \(1140 characters\)
  223. sed "s/^X//" >mtalk.man <<'END_OF_mtalk.man'
  224. X
  225. X
  226. X
  227. XMTALK(1-Questar)  Pyramid OSx Operating System   MTALK(1-Questar)
  228. X
  229. X
  230. X
  231. XNAME
  232. X     mtalk - Multitalk multi-user Talk Parlour
  233. X
  234. XORIGIN
  235. X     Questar Data Systems
  236. X
  237. XSYNOPSIS
  238. X     mtalk
  239. X
  240. XDESCRIPTION
  241. X     _m_t_a_l_k is a multi-user conference program which can support
  242. X     up to 20 users at the same time. When you run _m_t_a_l_k , you
  243. X     actually run a shell script which then runs the main program
  244. X     and is controlled in the _m_t_a_l_k directory which is defined
  245. X     upon compilation. This program allows you to have either
  246. X     public or private conversations with others who are logged
  247. X     into the program at that particular time. For information on
  248. X     the many commands, and procedures for using _m_t_a_l_k , refer to
  249. X     you site administrator for copies of the manual.
  250. X
  251. XFILES
  252. X     /usr/local/bin/mtalk - script that runs multitalk.
  253. X
  254. XBUGS
  255. X     _m_t_a_l_k will lose track of its loginfile if someone ctrl-C's
  256. X     out while in /auto. Other than that, the program is bullet-
  257. X     proof.
  258. X
  259. XAUTHOR
  260. X     Albert Viall
  261. X
  262. X
  263. X
  264. X
  265. X
  266. X
  267. X
  268. X
  269. X
  270. X
  271. X
  272. X
  273. X
  274. X
  275. X
  276. X
  277. X
  278. X
  279. X
  280. X
  281. X
  282. X
  283. X
  284. X
  285. X
  286. XPrinted 12/27/89                                                1
  287. X
  288. X
  289. X
  290. END_OF_mtalk.man
  291. echo shar: 25 control characters may be missing from \"mtalk.man\"
  292. if test 1140 -ne `wc -c <mtalk.man`; then
  293.     echo shar: \"mtalk.man\" unpacked with wrong size!
  294. fi
  295. # end of overwriting check
  296. fi
  297. if test -f multitalk.c -a "${1}" != "-c" ; then 
  298.   echo shar: Will not over-write existing file \"multitalk.c\"
  299. else
  300. echo shar: Extracting \"multitalk.c\" \(37371 characters\)
  301. sed "s/^X//" >multitalk.c <<'END_OF_multitalk.c'
  302. X/***********************************************
  303. X * 
  304. X * MultiTalk - Talk Parlour
  305. X * Multi-user Conferencing Program.
  306. X *
  307. X * Written and Developed by Albert Viall
  308. X * WARNING: Do not remove this header or alter it
  309. X *  in anyway. By releasing this source code into
  310. X *  public domain, the author allows minor changes
  311. X *  to the source code to suit the needs of the
  312. X *  user.
  313. X * 
  314. X * (C)1989
  315. X * All Rights Reserved
  316. X **********************************************/
  317. X
  318. X
  319. X#include <stdio.h>
  320. X#include <ctype.h>
  321. X#include <errno.h>
  322. X#include <signal.h>
  323. X#include <sgtty.h>
  324. X#include <assert.h>
  325. X#include <sys/file.h> 
  326. X#include <sys/time.h> 
  327. X#include "multitalk.h"
  328. X
  329. X#define BELL '\007'
  330. X#define WRITELOCAL "m_local"
  331. X#define WRITEALL   "m_all"
  332. X#define SENDLOCAL  "s_local"
  333. X#define SENDALL    "s_all"
  334. X#define WHISPER    "m_whisper"
  335. X#define SENDTO       "s_to"
  336. X
  337. Xchar name[40],*myroom,myfile[35];
  338. Xchar prompt[8];
  339. Xint yellcnt,mypid,echo,master;
  340. X
  341. X/* Global structure used for loginfile
  342. X * If you add or delete any login parameters, it must be
  343. X * done here first
  344. X */
  345. Xstruct logon {
  346. X    char thetty[12]; /* tty filename, i.e. /dev/ttyi34  */
  347. X    char uid_name[8]; /* the system login name */
  348. X    char logon_name[40]; /* Mtalk login name */
  349. X    char room[11]; /* current room */
  350. X    int thepid; /* this structures pidnumber */
  351. X    } logon_info[MAXUSERS]; /* MAXUSERS is defined in multitalk.h */
  352. Xint    cleanup();
  353. X
  354. Xmain()
  355. X{
  356. X    int x,z,y;
  357. X    char str[256],junk[9],*myname,*getlogin(),*mytty,*ttyname();  
  358. X
  359. X    /* Perform a tidy cleanup upon signal.
  360. X     * Thank you for keeping your area clean.
  361. X     */ 
  362. X    signal(SIGHUP,cleanup);
  363. X    signal(SIGINT,cleanup);
  364. X    security("compare",junk);  /* Am I in the purgefile? */
  365. X    master=0;
  366. X    mypid=getpid();
  367. X    myname=getlogin();
  368. X    mytty=ttyname(fileno(stdin));
  369. X    /* set global 'myfile' to search for my commfile */
  370. X    sprintf(myfile,"%s%d\0",PATH,mypid);  
  371. X    fopen(myfile,"a");  /* Open my commfile just to make sure its there */
  372. X    do_login();  
  373. X        sprintf(str,"### %s was just escorted into the Talk Parlour on %s.",&name,mytty);
  374. X    mwrite(SENDALL,"",str);
  375. X    get_comfile(); 
  376. X    do_message(myname,"read");
  377. X    yellcnt=0;
  378. X    echo=1;
  379. X    sprintf(prompt,"Say? \0"); /* set default input prompt */
  380. X    
  381. X
  382. X    /* main processing - things branch from here */
  383. X    for(;;) {
  384. X                str[0]='\0';
  385. X        printf("%s",prompt);
  386. X        gets(str);
  387. X        
  388. X        get_room();
  389. X        /* is str a command? */
  390. X        if (str[0]=='/') {
  391. X            parse_cmd(str);
  392. X            get_comfile();
  393. X            continue;
  394. X                }
  395. X
  396. X        /* did I input regular text? */
  397. X        if (strlen(str) != 0) {
  398. X            mwrite(WRITELOCAL,"",str);
  399. X            get_comfile();
  400. X            continue;  
  401. X                }  
  402. X        /* or did I hit a c/r */
  403. X        if (strlen(str) == 0) {
  404. X            get_comfile();
  405. X            continue;
  406. X            }
  407. X
  408. X
  409. X        } /* end of main processing */
  410. X} /* NOTREACHED */
  411. X
  412. Xchar     *
  413. Xdate()  /* returns date and time in the 26 character format */
  414. X{
  415. X    long t;
  416. X    register char *s;
  417. X    char *ctime();
  418. X
  419. X    time(&t);
  420. X    s=ctime(&t);
  421. X    return s;
  422. X}
  423. X
  424. Xvoid init_flds()
  425. X{  
  426. X    int t;
  427. X    
  428. X    /* This should be the first function to be called whenever a new
  429. X     * set of fields are incorporated into the array. It will
  430. X     * Initialize the entire array.
  431. X     */
  432. X    for (t=0; t<MAXUSERS; t++) {
  433. X        logon_info[t].thetty[0]='\0';
  434. X        logon_info[t].uid_name[0]='\0';
  435. X        logon_info[t].logon_name[0]='\0';
  436. X        logon_info[t].room[0]='\0';
  437. X        } 
  438. X}
  439. X
  440. X
  441. Xdo_login()
  442. X{
  443. X    /* This function performs all entry duties into the parlour
  444. X     * such as name input, status_display, and adding this entry
  445. X     * to the loginfile.
  446. X     */ 
  447. X    int z;
  448. X    FILE *lgnfd;
  449. X    char *ttyname(), *getlogin(), *mytty, *myname,*room;
  450. X    char byname[40],text[230];
  451. X    int accessible; 
  452. X
  453. X    mytty=ttyname(fileno(stdin));
  454. X    myname=getlogin();
  455. X    check_max(); /* check on how many slots are being used */ 
  456. X    /* Test access of lockfile and exit if found after user notify */
  457. X    if ((strcmp(myname,HEADMOO)==0)) goto bypass; /* Icck! I hate goto's */
  458. X    if ((accessible=access(LOCKFIL, 0))== 0) {
  459. X                     putchar(BELL);
  460. X            printf("\n\nThe Task has been locked from further entry by the Caretaker.");
  461. X            printf("\nFor further information, contact the Caretaker(%s)\n\n",HEADMOO);
  462. X            exit(0);
  463. X            }
  464. Xbypass: /* like I said above, I hate goto's, but there was no choice here
  465. X     * this is written here to allow noone into Mtalk when it has been
  466. X     * LOCKED except for the Caretaker.
  467. X     */
  468. X    printf("\n___________________________________________________________");
  469. X    printf("\n Multi*Talk           Talk Parlour                 Ver1.2 ");
  470. X    printf("\n      Multi-user Conferencing Program  by  Albert Viall");
  471. X    printf("\n-----------------------------------------------------------\n");
  472. X    printf("\n'Please sign-in at the Register' (%s): ", myname);
  473. X    gets(byname);
  474. X
  475. X    if (strlen(byname) ==0) {
  476. X                strcpy(byname,myname);
  477. X        strcpy(name,myname);
  478. X        } else {
  479. X            strcpy(name,byname);
  480. X            }
  481. X    room="Reception"; 
  482. X    myroom="Reception";
  483. X    check_users(); /* Check the uniqueness of your name. */
  484. X
  485. X    if ((lgnfd=fopen(LGNFILE,"a")) == NULL) {
  486. X        perror("do_login/lgnfd open error");
  487. X        exit(-1); 
  488. X                }
  489. X
  490. X    fprintf(lgnfd,"%s %s %s %s %d\n",mytty,myname,&byname,room,mypid);
  491. X    fflush(lgnfd); fclose(lgnfd);
  492. X        status_display(); 
  493. X
  494. X     printf("\nAll commands must be preceded by '/'. Type '/q' to Quit.\n");
  495. X    printf("Type '/?' for commands. Type '/news' for current news.\n");
  496. X    printf("\n'Greeves, the butler, escorts you into the Reception Hall.'\n");
  497. X    /* show a login entry in the dayfile for this person. */
  498. X    security("dayfile","Login ");
  499. X            return;  
  500. X}
  501. X
  502. Xparse_cmd(str)
  503. Xchar *str;  
  504. X{
  505. X    /* This function parses an Mtalk commandline which is always
  506. X     * preceded by a '/'.
  507. X     */ 
  508. X        FILE *lckfd,*pgfd;
  509. X    int i;
  510. X    int j=0;
  511. X    int b,y,accessible;
  512. X    char cmd[15],tty[8],ch;
  513. X        char arg[15],ttybuf[13];
  514. X        char obj[230],yell[230];
  515. X    char bro[230],t_lock[35],m_togl[35];   
  516. X    char *myname,*getlogin(),*mytty,*ttyname();
  517. X
  518. X    myname=getlogin();
  519. X    mytty=ttyname(fileno(stdin)); 
  520. X    obj[0]='\0';
  521. X    /* This FOR loop spans the string looking for how many spaces it can
  522. X     * find. We are only worried about the first two which would incorporate
  523. X     * a complete command I.e. CMD ARG OBJ
  524. X     */    
  525. X        y=0;
  526. X    for(i=0;i<strlen(str);i++) {
  527. X        if (isspace(str[i])) y++;
  528. X    /* If there is only one command argument. Null out ARG and OBJ */
  529. X        }
  530. X    if (y==0) {
  531. X        sscanf(str,"%s",cmd);
  532. X        arg[0]='\0';
  533. X        obj[0]='\0';
  534. X        }
  535. X    /* If there are two arguments ONLY. Null out the OBJ  */
  536. X    if (y==1) {
  537. X        sscanf(str,"%s %s",cmd,arg);
  538. X        obj[0]='\0';
  539. X        }
  540. X          /* More than than 2 args? Scan for CMD and ARG, then construct
  541. X     * OBJ character by character ending with a NULL.
  542. X     */
  543. X    if (y > 1) {
  544. X        y=0;
  545. X        sscanf(str,"%s %s",cmd,arg);
  546. X            for(i=0;!isspace(str[i]);i++) { continue; } 
  547. X        for(i++;!isspace(str[i]);i++) { continue; }
  548. X        for(i++;i<strlen(str);i++) {  
  549. X            obj[y]=str[i];
  550. X            y++;
  551. X            }
  552. X                obj[y]='\0';
  553. X        y=0;
  554. X        }
  555. X    /*    printf("\nCMD:%s\nARG:%s\nOBJ:%s\n",cmd,arg,obj);  */ 
  556. X        /* These string compares do the matching of the 'cmd' to whatever
  557. X     * command you are defining. All new commands MUST be defined in this
  558. X     * area.
  559. X    */  
  560. X    if (b=strcmp(cmd, "/q") == 0) {
  561. X                        do_logout(); 
  562. X            exit(0);
  563. X            }
  564. X    if (b=strcmp(cmd, "/?") == 0) {
  565. X                        read_text(CMDS,"pause"); 
  566. X            return;
  567. X            }
  568. X    if (b=strcmp(cmd, "/auto") == 0) {
  569. X            auto_mode(); 
  570. X            return;
  571. X            }
  572. X    if (b=strcmp(cmd, "/echo") == 0) {
  573. X            if (echo==1) {
  574. X                echo=0;
  575. X                printf("Echo Mode is OFF.\n");
  576. X                return;
  577. X                }
  578. X            if (echo==0) {
  579. X                echo=1;
  580. X                printf("Echo Mode is ON.\n");
  581. X                return;
  582. X                }
  583. X            return;
  584. X            }
  585. X    if (b=strcmp(cmd, "/news") == 0) {
  586. X                        read_text(NEWS,"pause"); 
  587. X            return;
  588. X            }
  589. X    if (b=strcmp(cmd, "/prompt") == 0) {
  590. X            if (strlen(arg)==0) {
  591. X                sprintf(prompt,"Say? \0");
  592. X                return;
  593. X                }
  594. X            sprintf(prompt,"%s \0",arg);
  595. X            return;
  596. X            }
  597. X    if (b=strcmp(cmd, "/whisper") == 0) {
  598. X            if (strlen(arg)==0) {
  599. X                printf("Usage is: /whisper [logon name] [mesg]\n");
  600. X                return;
  601. X                }
  602. X            mwrite(WHISPER,arg,obj);
  603. X            return;
  604. X            }
  605. X    /* by some of the following undocumented commands, you can see that
  606. X     * I intended for Mtalk to be somewhat humorous
  607. X     */ 
  608. X    if (b=strcmp(cmd, "/wear") == 0) {
  609. X            if (strlen(arg)==0) {
  610. X                sprintf(bro,"`%s just put on a lampshade.'",&name);
  611. X                mwrite(SENDLOCAL,"",bro);
  612. X                return;
  613. X                }
  614. X            sprintf(bro,"`%s just put on %s %s'",&name,arg,obj);
  615. X            mwrite(SENDLOCAL,"",bro);
  616. X            return;
  617. X            }
  618. X    if (b=strcmp(cmd, "/drink") == 0) {
  619. X            if (strlen(arg)==0) {
  620. X                sprintf(bro,"`%s just drank some Coke.'",&name);
  621. X                mwrite(SENDLOCAL,"",bro);
  622. X                return;
  623. X                }
  624. X            sprintf(bro,"`%s just drank %s %s'",&name,arg,obj);
  625. X            mwrite(SENDLOCAL,"",bro);
  626. X            return;
  627. X            }
  628. X    if (b=strcmp(cmd, "/eat") == 0) {
  629. X            if (strlen(arg)==0) {
  630. X                sprintf(bro,"`%s just ate some potato chips.'",&name);
  631. X                mwrite(SENDLOCAL,"",bro);
  632. X                return;
  633. X                }
  634. X            sprintf(bro,"`%s just ate %s %s.'",&name,arg,obj);
  635. X            mwrite(SENDLOCAL,"",bro);
  636. X            return;
  637. X            }
  638. X    if (b=strcmp(cmd, "/throwup") == 0) {
  639. X            if (strlen(arg)==0) {
  640. X                sprintf(bro,"`%s just threw up.'",&name);
  641. X                mwrite(SENDLOCAL,"",bro);
  642. X                return;
  643. X                }
  644. X            sprintf(bro,"`%s just threw up %s %s.'",&name,arg,obj);
  645. X            mwrite(SENDLOCAL,"",bro);
  646. X            return;
  647. X            }
  648. X    if (b=strcmp(cmd, "/fart") == 0) {
  649. X            sprintf(bro,"`%s just broke wind.'",&name);
  650. X            mwrite(SENDLOCAL,"",bro);
  651. X            return;
  652. X            }
  653. X    /* OKAY, Let's get back to serious */
  654. X    if (b=strcmp(cmd, "/time") == 0) {
  655. X                        printf("The Time is: %s",date()); 
  656. X            return;
  657. X            }
  658. X    if (b=strcmp(cmd, "/status") == 0) {
  659. X                        status_display(); 
  660. X            return;
  661. X            }
  662. X    if (b=strcmp(cmd, "/moderator") == 0) {
  663. X        if (strcmp(myroom,"Reception")!=0) {
  664. X            if (master==1) {
  665. X                moderator("unmaster","moo");
  666. X                return;
  667. X                } else {
  668. X                moderator("master","moo");
  669. X                return;
  670. X                }
  671. X            } else {
  672. X            printf("You may not Moderate the Reception Hall.\n");
  673. X            return;
  674. X            }
  675. X        }
  676. X    if (b=strcmp(cmd, "/remove") == 0) {
  677. X        if (strcmp(myroom,"Reception")!=0) {
  678. X            if (master==1) {
  679. X                moderator("remove",arg);
  680. X                return;
  681. X                }
  682. X            printf("You are not the Moderator of this table.\n");
  683. X            return;
  684. X            } else {
  685. X            printf("You may not Remove anyone from the Reception Hall.\n");
  686. X            return;
  687. X            }
  688. X        }
  689. X    if (b=strcmp(cmd, "/open") == 0) {
  690. X        if (strcmp(myroom,"Reception")!=0) {
  691. X            if (master==1) {
  692. X                moderator("open","moo");
  693. X                return;
  694. X                }
  695. X            printf("You are not the Moderator of this table.\n");
  696. X            return;
  697. X            } else {
  698. X            printf("You may not Open/Close the Reception Hall.\n");
  699. X            return;
  700. X            }
  701. X        }
  702. X    if (b=strcmp(cmd, "/close") == 0) {
  703. X        if (strcmp(myroom,"Reception")!=0) {
  704. X            if (master==1) {
  705. X                moderator("close","moo");
  706. X                return;
  707. X                }
  708. X            printf("You are not the Moderator of this table.\n");
  709. X            return;
  710. X            } else {
  711. X            printf("You may not Open/Close the Reception Hall.\n");
  712. X            return;
  713. X            }
  714. X        }
  715. X    if (b=strcmp(cmd, "/message") == 0) {
  716. X            if (strlen(arg)==0) {
  717. X                printf("You must specify someone to send it to.\n");
  718. X                return;
  719. X                }
  720. X            do_message(arg,"write");
  721. X            return;
  722. X            }
  723. X    if (b=strcmp(cmd, "/lock") == 0) {
  724. X        if (y=strcmp(myname,HEADMOO)!=0) {
  725. X            putchar(BELL); 
  726. X            printf("This Command reserved for Caretaker.\n");
  727. X                        return;  
  728. X            }   
  729. X                if ((accessible=access(LOCKFIL,0)) ==0) {
  730. X            unlink(LOCKFIL);
  731. X            security("dayfile","UNLOCK");
  732. X            mwrite(SENDALL,"","`Greeves just opened the doors to the Parlour.'");
  733. X            return;
  734. X            } else { 
  735. X            fopen(LOCKFIL,"a"); 
  736. X                }     
  737. X            mwrite(SENDALL,"","`Greeves has just bolted the doors shut. No further entry is permitted.'");
  738. X            security("dayfile","LOCK  ");
  739. X            return;
  740. X            }
  741. X    if (b=strcmp(cmd, "/logoff") == 0) {
  742. X        if (y=strcmp(myname,HEADMOO)!=0) {
  743. X            putchar(BELL); 
  744. X            printf("\nThis Command reserved for Caretaker.\n");
  745. X                        return;  
  746. X            }   
  747. X        if (strlen(arg)==0) {
  748. X            printf("You must specify someone to 'logoff'.\n");
  749. X            return;
  750. X            }
  751. X        sprintf(bro,"### %s was just forcibly logged off by a Caretaker.",arg);
  752. X        logoff(arg);
  753. X        mwrite(SENDALL,"",bro);    
  754. X        return;
  755. X        }
  756. X    if (b=strcmp(cmd, "/dayfile") == 0) {
  757. X        if (y=strcmp(myname,HEADMOO)!=0) {
  758. X            putchar(BELL); 
  759. X            printf("\nThis Command reserved for Caretaker.\n");
  760. X                        return;  
  761. X            }   
  762. X        printf("\nSTATUS - UID - LOGINAME - TIME DESCRIPTION\n");
  763. X        printf("=============================================\n\n"); 
  764. X        read_text(DAYFILE,"pause"); /* show dayfile and pause */
  765. X        return;
  766. X        }
  767. X    if (b=strcmp(cmd, "/broadcast") == 0) {
  768. X        if (y=strcmp(myname,HEADMOO)!=0) {
  769. X            putchar(BELL); 
  770. X            printf("This Command reserved for Caretaker.\n");
  771. X                        return;  
  772. X            }   
  773. X        sprintf(bro,"### BROADCAST(%s): %s %s",&name,arg,obj);
  774. X        mwrite(SENDALL,"",bro);
  775. X        return;
  776. X        }
  777. X    if (b=strcmp(cmd, "/purge") == 0) {
  778. X        if (y=strcmp(myname,HEADMOO)!=0) {
  779. X            putchar(BELL); 
  780. X            printf("This Command reserved for Caretaker.\n");
  781. X                        return;  
  782. X            }   
  783. X        security("purge",arg); 
  784. X        return;
  785. X        }
  786. X    if (b=strcmp(cmd, "/page") == 0) {
  787. X            system("who | more");
  788. X            printf("\nPage which TTY(i.e. ttyi19)?");
  789. X            gets(tty);
  790. X            sprintf(ttybuf,"/dev/%s",tty);
  791. X            if ((pgfd=fopen(ttybuf,"w"))==NULL) {
  792. X                perror("PAGE Device not found");
  793. X                return;
  794. X                }
  795. X            fputc(BELL,pgfd);
  796. X            fprintf(pgfd,"\n** %s(%s) Paged you to the Talk Parlour **\n respond with 'mtalk' , %s",myname,mytty,date());
  797. X            fflush(pgfd); fclose(pgfd);
  798. X            return;
  799. X            }
  800. X    if (b=strcmp(cmd, "/yell") == 0) {
  801. X            sprintf(yell,"%s %s",arg,obj);
  802. X            mwrite(WRITEALL,"",yell);
  803. X            return;
  804. X            }  
  805. X    if (b=strcmp(cmd, "/sit") == 0) {
  806. X            if (strlen(arg)==0) {
  807. X                moderator("cleanup","moo");
  808. X                moderator("unmaster","moo");    
  809. X                sit("Reception");
  810. X                printf("You get up and walk back to the Reception Hall.\n");
  811. X                return;
  812. X                }
  813. X            sprintf(t_lock,"%s%s.LCK\0",PATH,arg);
  814. X            if ((accessible=access(t_lock,0))==0) {
  815. X                printf("The `%s' table has been closed from further entry.\n",arg);
  816. X                return;
  817. X                }
  818. X            sit(arg);
  819. X            printf("You sit down at the `%s' table.\n",arg);
  820. X            return;
  821. X            }  
  822. X    if (b=strcmp(cmd, "/look") == 0) {
  823. X                  if (strcmp(myroom,"Reception")==0) {
  824. X                printf("You are in the Reception Hall.\n");
  825. X                return;
  826. X                }
  827. X            printf("You are sitting at the `%s' table.\n",myroom);
  828. X            sprintf(t_lock,"%s%s.LCK\0",PATH,myroom);
  829. X            sprintf(m_togl,"%s%s.MAS\0",PATH,myroom);
  830. X            if ((accessible=access(m_togl,0))==0) {
  831. X                printf("This table is Moderated.\n");
  832. X                }
  833. X            if (master==1) {
  834. X                printf("You are the Moderator.\n");
  835. X                }
  836. X            if ((accessible=access(t_lock,0))==0) {
  837. X                printf("The table is Closed from further entry.\n");
  838. X                }
  839. X            return;
  840. X            }  
  841. X    /* Stupid? or what?? */             
  842. X    printf("Huh? I don't understand.\nType '/?' for commands.\n");            
  843. X    return;
  844. X}
  845. Xvoid status_display()
  846. X{
  847. X    /* This will display the user status of Mtalk. It also tests
  848. X     * to see if you are HEADMOO, and displays usefull information
  849. X     * for Caretakers eye's only.
  850. X     */
  851. X    int z,y,i,max_i,accessible;
  852. X    FILE *lgofd;
  853. X    char shmoo[80],*myname,*getlogin();
  854. X
  855. X    if ((lgofd=fopen(LGNFILE,"r")) == NULL) { /* Open the loginfile */ 
  856. X        perror("Open Error reading LGNFILE");
  857. X        exit(-1);
  858. X            }
  859. X    myname=getlogin(); 
  860. X    init_flds();
  861. X        /* Read a line from LGOFD until EOF. Each line in loginfile consists
  862. X     * of info regarding each user logged into MTALK.
  863. X     */
  864. X    max_i=0;
  865. X    for (i=0; i<MAXUSERS; i++) {
  866. X        if (feof(lgofd)) break;
  867. X        fscanf(lgofd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  868. X        } 
  869. X        max_i=i-1;  
  870. X    fclose(lgofd);
  871. X
  872. X    /* Okay, now format the header */
  873. X        printf("\nThe following are currently in the Talk Parlour:");
  874. X    printf("\n==================================================================");
  875. X    printf("\n Name                           Terminal        Uid       Room    ");
  876. X    printf("\n------------------------------------------------------------------");
  877. X
  878. X    /* Now print out status, all fields are left justified  */
  879. X    for (i=0; i<max_i; i++) { 
  880. X            if ((strcmp(logon_info[i].room,"Reception")==0)) {
  881. X              printf("\n%-17.17s             %-11.11s       %-8.8s %-10.10s",logon_info[i].logon_name,logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].room);
  882. X                  continue;
  883. X                                }  
  884. X            if ((strcmp(logon_info[i].room,"Casino")==0)) {
  885. X              printf("\n%-17.17s             %-11.11s       %-8.8s %-10.10s",logon_info[i].logon_name,logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].room);
  886. X                  continue;
  887. X                                }  
  888. X
  889. X              printf("\n%-17.17s             %-11.11s       %-8.8s *********",logon_info[i].logon_name,logon_info[i].thetty,logon_info[i].uid_name);
  890. X                                 }
  891. X        /* Print the trailer */ 
  892. X    printf("\n==================================================================\n");
  893. X    /* If I am HEADMOO, tell me if the task is locked */
  894. X    if (y=strcmp(myname,HEADMOO)==0) {
  895. X        if ((accessible=access(LOCKFIL,0))==0){
  896. X            printf("\t\t\tThe Task is LOCKED.\n");
  897. X            }
  898. X        }  
  899. X}  
  900. Xvoid do_logout()
  901. X{
  902. X    /* This function performs a gracefull logout. What is done, is that
  903. X     * the loginfile is loaded into the logon_info array. Then, the
  904. X     * program matches you with your corresponding login entry and
  905. X     * NULLS it out. Lastly, the loginfile is unlinked and the remaining
  906. X     * entries are written to a new loginfile minus your's.
  907. X     */
  908. X    int z,y,i,max_i;
  909. X    FILE *lgofd; 
  910. X    char *ttyname(), *getlogin(), *mytty, *myname,junk[230];
  911. X
  912. X    /* Initialize the array fields */
  913. X    init_flds();
  914. X    mytty=ttyname(fileno(stdin));
  915. X    myname=getlogin();
  916. X    sprintf(junk,"### %s just left the Talk Parlour on %s.",&name,mytty);
  917. X    mwrite(SENDALL,"",junk);
  918. X
  919. X    /* Open this blasted file */
  920. X    if ((lgofd=fopen(LGNFILE,"r+"))==NULL) {
  921. X        perror("Open error on do_logout()");
  922. X        exit(-1);
  923. X        }
  924. X    /* Read in the loginfile */
  925. X    for (i=0; i<MAXUSERS; i++) {
  926. X        if (feof(lgofd)) break;
  927. X        fscanf(lgofd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  928. X        } 
  929. X        max_i=i-1; 
  930. X    fclose(lgofd);
  931. X
  932. X    /* Compare Array 'thetty' to mine to get a match */
  933. X    for (i=0; i<max_i; i++) {
  934. X        if (strcmp(mytty,logon_info[i].thetty)==0) {
  935. X            /* A match to my tty is found */
  936. X            logon_info[i].thetty[0]='\0'; /* NULL it out */
  937. X            break;
  938. X            }
  939. X        }
  940. X    unlink(LGNFILE); /* We don't need it now, erase it */
  941. X        /* Open the new loginfile */
  942. X    if ((lgofd=fopen(LGNFILE,"a"))==NULL) {
  943. X        perror("Open error on do_logout()2");
  944. X        exit(-1);
  945. X        }
  946. X
  947. X    /* Put the array into the new file except for mine */
  948. X    for (i=0; i<max_i; i++) {
  949. X        if (strlen(logon_info[i].thetty)!=0) {
  950. X            fprintf(lgofd,"%s %s %s %s %d\n",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,logon_info[i].thepid);
  951. X            }
  952. X        continue;
  953. X        }
  954. X    fclose(lgofd);
  955. X    get_comfile();
  956. X    moderator("cleanup","moo");  /* Do this on the possibility that someone
  957. X                * logs out while at a table.
  958. X                */
  959. X    /* put entry into dayfile that I logged out */
  960. X    security("dayfile","Logout");
  961. X        printf("\nThanks for using M*Talk...\n");
  962. X}
  963. Xread_text(news,pause) 
  964. Xchar *news;
  965. Xchar *pause; 
  966. X{
  967. X    /* This function will read a text file in one of two ways depending
  968. X     * upon the parameters it has been given. If "pause" is passed
  969. X     * it will display the file and pause every 23 lines and wait for
  970. X     * a c/r. Otherwise, "nopause" should be passed.
  971. X     */
  972. X    FILE *rn;
  973. X    int c,y,cnt;
  974. X    char ch;
  975. X
  976. X    if ((rn=fopen(news,"r"))==NULL) {
  977. X        return;
  978. X        }
  979. X    
  980. X    if (y=strcmp(pause,"nopause") == 0) {
  981. X        while ((c=getc(rn))!=EOF)
  982. X            putc(c,stdout);
  983. X
  984. X        fclose(rn);  
  985. X        return;
  986. X        }
  987. X
  988. X    if (y=strcmp(pause,"pause") == 0) {
  989. X        while ((c=getc(rn))!=EOF) {
  990. X            if (c=='\n') cnt++;
  991. X            if (cnt==23) {
  992. X                 printf("\n- 'Return' for more or 'q' to Quit -");
  993. X                 ch=getchar();
  994. X                if (strcmp(ch,'q')==0) {
  995. X                    break;
  996. X                    } else {
  997. X                printf("\013\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
  998. X                    cnt=0;
  999. X                    continue;
  1000. X                    }
  1001. X                }
  1002. X            putc(c,stdout);
  1003. X            }
  1004. X        fclose(rn);
  1005. X        return;
  1006. X        }
  1007. X
  1008. X}      
  1009. X
  1010. Xsit(where)
  1011. Xchar *where;
  1012. X{
  1013. X    /* function is self-explanatory. It corresponds to the /SIT
  1014. X     * command.
  1015. X     */
  1016. X
  1017. X    FILE *lgnfd,*outfd;
  1018. X    int max_i,i,y,accessible;
  1019. X    char *ttyname(),*getlogin(),*mytty,*myname,stuff[230],pid[5],t_lock[35];
  1020. X
  1021. X    sprintf(t_lock,"%s%s.LCK\0",PATH,where);
  1022. X
  1023. X    if ((lgnfd=fopen(LGNFILE,"r"))== NULL) {
  1024. X        perror("Open error on sit()/LGNFD");
  1025. X        return;
  1026. X        }
  1027. X        strcpy(myroom,where);
  1028. X    mytty=ttyname(fileno(stdin));
  1029. X    myname=getlogin();
  1030. X    init_flds(); /* Initialize the array */
  1031. X    max_i=0;
  1032. X    
  1033. X    /* Get the info */
  1034. X    for(i=0;i<MAXUSERS;i++) {
  1035. X        if (feof(lgnfd)) break;
  1036. X        fscanf(lgnfd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  1037. X        }
  1038. X    max_i=i-1;
  1039. X
  1040. X    /* Set my array table equal to my physical table */
  1041. X    for(i=0; i<max_i; i++) {
  1042. X        if (strcmp(mytty,logon_info[i].thetty)==0) {
  1043. X            strcpy(logon_info[i].room, myroom);
  1044. X            break;
  1045. X            }
  1046. X        continue;
  1047. X        }
  1048. X    /* Now tell everyone but me, that I sat down at their table */
  1049. X    for(i=0; i<max_i; i++) {
  1050. X        if (strlen(where)==0) break;  
  1051. X        if (strcmp(mytty,logon_info[i].thetty)==0) {
  1052. X            continue;
  1053. X            }
  1054. X        sprintf(pid,"%s%d",PATH,logon_info[i].thepid);
  1055. X        if (strcmp(logon_info[i].room,myroom) ==0) {
  1056. X            if ((outfd=fopen(pid,"a"))==NULL) {
  1057. X                perror("open error commfile/sit");
  1058. X                continue;
  1059. X                }
  1060. X            sprintf(stuff,"`%s' just sat down at your table.\n\0",&name);
  1061. X            fwrite(stuff,sizeof(char),strlen(stuff),outfd);
  1062. X            fflush(outfd); fclose(outfd);
  1063. X            continue;
  1064. X            }
  1065. X        continue;
  1066. X        }
  1067. X
  1068. X                
  1069. X    unlink(LGNFILE);
  1070. X    if ((outfd=fopen(LGNFILE,"a")) ==NULL) {
  1071. X        perror("sit()/outfd");
  1072. X        exit(-1);
  1073. X        }
  1074. X    for(i=0; i<max_i; i++) {
  1075. X            fprintf(outfd,"%s %s %s %s %d\n",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,logon_info[i].thepid);
  1076. X             }
  1077. X    fclose(outfd);
  1078. X}
  1079. X
  1080. Xsecurity(which,who)
  1081. Xchar *which;
  1082. Xchar *who;
  1083. X{
  1084. X    /* This function deals with security specific operations.
  1085. X     * Most notably, the /PURGE command. But also, handles the
  1086. X     * dayfile entry.
  1087. X     */
  1088. X    FILE *prgfd;
  1089. X    char *getlogin(),*myname,junk[9];
  1090. X
  1091. X    myname=getlogin();
  1092. X
  1093. X    if (strcmp(which,"purge")==0) {
  1094. X        if ((prgfd=fopen(PRGFILE,"a"))==NULL) {
  1095. X            perror("security/purge open error");
  1096. X            return;
  1097. X            }
  1098. X        fprintf(prgfd,"%s\n",who);
  1099. X        fflush(prgfd); fclose(prgfd);
  1100. X        printf("\n`%s' has now been purged from Mtalk.\n",who);
  1101. X        return;
  1102. X        }
  1103. X    if (strcmp(which,"dayfile")==0) {
  1104. X        if ((prgfd=fopen(DAYFILE,"a"))==NULL) {
  1105. X            perror("security/dayfile open error");
  1106. X            return;
  1107. X            }
  1108. X        fprintf(prgfd,"%s-%s-%s-%s",who,myname,&name,date());
  1109. X        fflush(prgfd); fclose(prgfd);
  1110. X        return;
  1111. X        }
  1112. X    if (strcmp(which,"compare")==0) {
  1113. X        if ((prgfd=fopen(PRGFILE,"r"))==NULL) {
  1114. X            return;
  1115. X            }   
  1116. X        for(;;) {
  1117. X            if (feof(prgfd)) break;
  1118. X            fscanf(prgfd,"%s",junk);
  1119. X            if (strcmp(myname,junk)==0) {
  1120. X                putchar(BELL); 
  1121. X                printf("\n**** Your access to M*talk has been removed indefinately.\n**** Please see the Caretaker for further info.\n");
  1122. X                exit(1);
  1123. X                }
  1124. X            continue;
  1125. X            }
  1126. X        return;
  1127. X        }
  1128. X} /* NOTREACHED End of Security function */
  1129. X
  1130. Xget_comfile()
  1131. X{
  1132. X    /* This function will read your corresponding commfile and then
  1133. X     * unlink it to ready it for further appendages. 
  1134. X     */
  1135. X    read_text(myfile,"nopause");
  1136. X    unlink(myfile);
  1137. X}
  1138. X
  1139. Xvoid check_max()
  1140. X{
  1141. X    /* This function checks to make sure there arent MAXUSERS on Mtalk
  1142. X     * and is called before anything else.
  1143. X     */
  1144. X    int z,y,i,max_i;
  1145. X    FILE *lgofd; 
  1146. X    char *ttyname(), *getlogin(), *mytty, *myname;
  1147. X
  1148. X    /* Initialize the array fields */
  1149. X    init_flds();
  1150. X    mytty=ttyname(fileno(stdin));
  1151. X    myname=getlogin();
  1152. X
  1153. X    /* Open this blasted file */
  1154. X    if ((lgofd=fopen(LGNFILE,"r+"))==NULL) {
  1155. X        perror("Warning: Open error on loginfile, no big deal.");
  1156. X        return;
  1157. X        }
  1158. X    for (i=0; i<MAXUSERS; i++) {
  1159. X        if (feof(lgofd)) break;
  1160. X        fscanf(lgofd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  1161. X        } 
  1162. X        max_i=i-1; 
  1163. X    fclose(lgofd);
  1164. X    if (max_i < MAXUSERS) {
  1165. X        return;
  1166. X        }
  1167. X    putchar(BELL);
  1168. X    printf("\n\n*** Sorry, M*Talk is full right Now. Try again later. ***\n\n");
  1169. X    exit(0);
  1170. X}
  1171. Xauto_mode()
  1172. X{
  1173. X    /* The function for /AUTO. Here, we must change the term. 
  1174. X     * characteristics, and then build a bitmap of the file descriptors
  1175. X     * we are interested in looking at. In this case, stdin does just fine.
  1176. X     * Then, we delay one second, so as not to tie anything up, and 
  1177. X     * constantly check for our commfile. If it's there, display it.
  1178. X     */
  1179. X    int accessible, mypid, template[2], mask[2], st;
  1180. X    struct sgttyb ttysettings;
  1181. X    struct timeval delay;
  1182. X
  1183. X    /* set the terminal characteristics */
  1184. X    assert(ioctl(fileno(stdin), TIOCGETP, &ttysettings) ==0);
  1185. X    ttysettings.sg_flags &= (~ECHO); /* no echo */
  1186. X    ttysettings.sg_flags |= CBREAK; /* half raw, still allows signals */
  1187. X    template[fileno(stdin)/32] = 1 << (fileno(stdin)%32);
  1188. X
  1189. X    delay.tv_sec=1;
  1190. X    delay.tv_usec=0;
  1191. X
  1192. X    printf("\nAuto Mode - Press `ENTER' to abort.\n");
  1193. X    for(;;) {
  1194. X        int n;
  1195. X        /* We must do this copy because select smashes the mask all
  1196. X         * to hell each time it is called.
  1197. X         */
  1198. X        (void) bcopy(template,mask,2 * sizeof(int));
  1199. X        assert(n=select(1,mask,0L,0L,&delay) >= 0);
  1200. X
  1201. X    /* If input pending, store it and read it. Mask is now hosed */
  1202. X    if (n && (mask[fileno(stdin)/32] & (1 << (fileno(stdin)%32)))) {
  1203. X        char c;
  1204. X        assert(read(fileno(stdin),&c,sizeof(char)) > 0);
  1205. X        if (c=='\n') break;
  1206. X        }
  1207. X    /* if Myfile is there, read the thing */
  1208. X    if ((accessible=access(myfile,0))==0) {
  1209. X        get_comfile();
  1210. X        continue;
  1211. X        }
  1212. X    }
  1213. X    /* Reset the terminal. This should really be a signal call, in case
  1214. X     * someone hits control-C, but most people use TCSH, and the shell
  1215. X     * does all that for us.
  1216. X     */    
  1217. X    ttysettings.sg_flags |= ECHO;
  1218. X    ttysettings.sg_flags &= (~CBREAK);
  1219. X    assert(ioctl(fileno(stdin), TIOCSETP, &ttysettings)==0);
  1220. X    return;
  1221. X}
  1222. Xcleanup(sig)
  1223. X{
  1224. X    /* This routine provides a tidy exit from the program upon
  1225. X     * an ungracefull exit by the user. This routine is used only
  1226. X     * with the signal calls shown at the beginning of this
  1227. X      * source code.
  1228. X     */
  1229. X    kill(mypid,SIGHUP); 
  1230. X    do_logout();
  1231. X    exit(0);
  1232. X}
  1233. Xvoid check_users() 
  1234. X{
  1235. X    /* This function compares your name that you inputted with the
  1236. X     * logonnames which are in the parlour at your login. If we get
  1237. X     * a match, then we can't let you in. Must not have more than one
  1238. X     * person of the same name online.
  1239. X     */
  1240. X    int z,y,i,max_i,accessible;
  1241. X    FILE *lgofd;
  1242. X    char shmoo[80],*myname,*getlogin();
  1243. X
  1244. X    if ((lgofd=fopen(LGNFILE,"r")) == NULL) { /* Open the loginfile */ 
  1245. X        perror("Warning: Open Error reading loginfile, no big deal.");
  1246. X        return;
  1247. X            }
  1248. X    myname=getlogin(); 
  1249. X    init_flds();
  1250. X        /* Read a line from LGOFD until EOF. Each line in loginfile consists
  1251. X     * of info regarding each user logged into MTALK.
  1252. X     */
  1253. X    max_i=0;
  1254. X    for (i=0; i<MAXUSERS; i++) {
  1255. X        if (feof(lgofd)) break;
  1256. X        fscanf(lgofd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  1257. X        } 
  1258. X        max_i=i-1;  
  1259. X    fclose(lgofd);
  1260. X
  1261. X    /* Now compare all the logonnames. */
  1262. X    for (i=0; i<max_i; i++) {
  1263. X        if (strcmp(&name,logon_info[i].logon_name)==0) {
  1264. X            putchar(BELL);
  1265. X            printf("\n\nThat Name is already in use. Try another name.\n\n");
  1266. X            exit(-1);
  1267. X            }
  1268. X        continue;
  1269. X        }
  1270. X}
  1271. Xdo_message(who,what)
  1272. Xchar *who;
  1273. Xchar *what;
  1274. X{
  1275. X    FILE *msgfd;
  1276. X    int y,accessible,i,lineno;
  1277. X    char *myname, *getlogin(), stuff[20], msg[80], file[35],ch;
  1278. X    struct message {
  1279. X        char line[80];
  1280. X        } text[20];
  1281. X
  1282. X    myname=getlogin();
  1283. X    sprintf(file,"%s%s\0",PATH,who);
  1284. X
  1285. X    if (strcmp(what,"write")==0) {
  1286. X        printf("\nGreeves says,`You wish to write a small message to (%s)?'\n`First, make sure that is the correct logon for this person.'\n",who);
  1287. X        printf("\nContinue(yes or no)?");
  1288. X        gets(stuff);
  1289. X        if (strcmp(stuff,"no")==0) { return; }
  1290. X        if (strlen(stuff)==0) return;
  1291. X
  1292. X        sprintf(msg,"********* A message from (%s), sent on %s\n",myname,date());
  1293. X        lineno=1;
  1294. X        printf("\nMessage to (%s) on %sYou may write up to 20 lines. End the message with a 'blank' line.\n\n",who,date());
  1295. X        for (i=0; i<20; i++) {
  1296. X            printf("%d> ",lineno);
  1297. X            gets(text[i].line);
  1298. X            if (strlen(text[i].line)==0) break;
  1299. X            lineno++;
  1300. X            }
  1301. X        printf("Do you want to (s)end it, or (f)orget it? ");
  1302. X        ch=getchar();
  1303. X        
  1304. X        switch(ch) {
  1305. X            case 's':
  1306. X                break;
  1307. X            case 'f':
  1308. X                printf("\n`Nothing sent..'");
  1309. X                return;
  1310. X            default:
  1311. X                printf("\n`Nothing sent..'");
  1312. X                return;
  1313. X            }
  1314. X
  1315. X                
  1316. X        if ((msgfd=fopen(file,"a"))==NULL) {
  1317. X            perror("error on msgfd");
  1318. X            return;
  1319. X            }
  1320. X        fprintf(msgfd,"-------------------------------------------------------------------\n");
  1321. X        fprintf(msgfd,"%s\0",msg);
  1322. X        for (i=0; i<lineno; i++) {
  1323. X            fprintf(msgfd,"%s\n\0",text[i].line);
  1324. X            }
  1325. X        fprintf(msgfd,"-------------------------------------------------------------------\n");
  1326. X        fflush(msgfd); fclose(msgfd);
  1327. X        printf("\nGreeves says,`Allright %s, when I see %s, I shall givehim/her the message.'\n",&name,who);
  1328. X        sprintf(file,"Wmsg (%s)\0",who);
  1329. X        security("dayfile",file);    
  1330. X        return;
  1331. X        }
  1332. X
  1333. X    if (strcmp(what,"read")==0) {
  1334. X        if ((accessible=access(file,0))==0) {
  1335. X            putchar(BELL);
  1336. X            printf("\nGreeves says,`Excuse me, I believe you have a message.'\n Would you like it now(yes or no)?");
  1337. X            gets(stuff);
  1338. X            if (strlen(stuff)==0) return;
  1339. X            if (strcmp(stuff,"no")==0) {
  1340. X                printf("\nGreeves says,`Allright %s, I shall save it for you until later.'\n\n",&name);
  1341. X                return;
  1342. X                }
  1343. X
  1344. X            printf("\n`Greeves hands you a piece of paper and then leaves.'\n");
  1345. X            read_text(file,"pause");
  1346. X            unlink(file);
  1347. X            return;
  1348. X            }
  1349. X        return;
  1350. X        }
  1351. X}
  1352. X
  1353. Xmoderator(what,who)
  1354. Xchar *what;
  1355. Xchar *who;
  1356. X{
  1357. X    FILE *lgnfd,*outfd;
  1358. X    int max_i,i,accessible;
  1359. X    char stuff[80],*myname,*getlogin(),m_togl[35],t_lock[35];
  1360. X
  1361. X    sprintf(t_lock,"%s%s.LCK\0",PATH,myroom);
  1362. X    sprintf(m_togl,"%s%s.MAS\0",PATH,myroom);
  1363. X
  1364. X    myname=getlogin();
  1365. X
  1366. X    if (strcmp(what,"master")==0) {
  1367. X        if (((accessible=access(m_togl,0))==0)&&(master==1)) {
  1368. X            printf("You are already Moderator of this table.\n");
  1369. X            return;
  1370. X            }
  1371. X        if (((accessible=access(m_togl,0))==0)&&(master==0)) {
  1372. X            printf("Someone is already Moderator of this table.\n");
  1373. X            return;
  1374. X            }
  1375. X        master=1;
  1376. X        sprintf(stuff,"`%s' is now Moderator of this table.",&name);
  1377. X        mwrite(SENDLOCAL,"",stuff);
  1378. X        fopen(m_togl,"a");
  1379. X        return;
  1380. X        }
  1381. X    if (strcmp(what,"unmaster")==0) {
  1382. X        if (((accessible=access(m_togl,0))==0)&&(master==1)) {
  1383. X            unlink(m_togl);
  1384. X            master=0;
  1385. X            return;
  1386. X            }
  1387. X        return;
  1388. X        }
  1389. X
  1390. X    if (strcmp(what,"close")==0) {
  1391. X        if (((accessible=access(t_lock,0))==0)&&(master==1)) {
  1392. X            printf("This table is already Closed.\n");
  1393. X            return;
  1394. X            }
  1395. X        fopen(t_lock,"a");
  1396. X        sprintf(stuff,"`%s' has just Closed this table from further entry.",&name);
  1397. X        mwrite(SENDLOCAL,"",stuff);
  1398. X        return;
  1399. X        }
  1400. X    if (strcmp(what,"open")==0) {
  1401. X        if (((accessible=access(t_lock,0))!=0)&&(master==1)) {
  1402. X            printf("This table is already Open.\n");
  1403. X            return;
  1404. X            }
  1405. X        unlink(t_lock);
  1406. X        sprintf(stuff,"`%s' has just Opened this table.",&name);
  1407. X        mwrite(SENDLOCAL,"",stuff);
  1408. X        return;
  1409. X        }
  1410. X    if (strcmp(what,"cleanup")==0) {
  1411. X        if (((accessible=access(m_togl,0))==0)&&(master==1)) {
  1412. X            unlink(m_togl);
  1413. X            }
  1414. X        if (((accessible=access(t_lock,0))==0)&&(master==1)) {
  1415. X            unlink(t_lock);
  1416. X            }
  1417. X        return;
  1418. X        }
  1419. X    if (strcmp(what,"remove")==0) {
  1420. X      if (strcmp(who,&name)==0) {
  1421. X        printf("You can't 'remove' yourself from a table.\n");
  1422. X        return;
  1423. X        }
  1424. X      if ((lgnfd=fopen(LGNFILE,"r"))== NULL) {
  1425. X        perror("Open error on sit()/LGNFD");
  1426. X        return;
  1427. X        }
  1428. X      init_flds(); /* Initialize the array */
  1429. X      max_i=0;
  1430. X    
  1431. X      /* Get the info */
  1432. X      for(i=0;i<MAXUSERS;i++) {
  1433. X        if (feof(lgnfd)) break;
  1434. X        fscanf(lgnfd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  1435. X        }
  1436. X        fclose(lgnfd);
  1437. X      max_i=i-1;
  1438. X    for(i=0;i<max_i;i++) {
  1439. X        if ((strcmp(logon_info[i].logon_name,who)==0)&&(strcmp(logon_info[i].room,myroom)==0)) {
  1440. X            sprintf(stuff,"*** `%s' was just removed from the table by the Moderator.",who);
  1441. X            mwrite(SENDLOCAL,"",stuff);
  1442. X            strcpy(logon_info[i].room,"Reception");
  1443. X            break;
  1444. X            }
  1445. X        continue;
  1446. X        }
  1447. X    unlink(LGNFILE);
  1448. X    if ((outfd=fopen(LGNFILE,"a"))==NULL) {
  1449. X        perror("/master - remove");
  1450. X        return;
  1451. X        }
  1452. X    for(i=0; i<max_i; i++) {
  1453. X            fprintf(outfd,"%s %s %s %s %d\n",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,logon_info[i].thepid);
  1454. X             }
  1455. X    fclose(outfd);
  1456. X    }
  1457. X
  1458. X}
  1459. Xget_room()
  1460. X{
  1461. X    FILE *lgnfd;
  1462. X    int i,y,max_i;
  1463. X    char *mytty,*ttyname();
  1464. X    
  1465. X      if ((lgnfd=fopen(LGNFILE,"r"))== NULL) {
  1466. X        perror("Open error on sit()/LGNFD");
  1467. X        return;
  1468. X        }
  1469. X      init_flds(); /* Initialize the array */
  1470. X      max_i=0;
  1471. X    mytty=ttyname(fileno(stdin));
  1472. X    
  1473. X      /* Get the info */
  1474. X      for(i=0;i<MAXUSERS;i++) {
  1475. X        if (feof(lgnfd)) break;
  1476. X        fscanf(lgnfd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  1477. X        }
  1478. X        fclose(lgnfd);
  1479. X      max_i=i-1;
  1480. X    for(i=0;i<max_i;i++) {
  1481. X        if (strcmp(mytty,logon_info[i].thetty)==0) {
  1482. X            strcpy(myroom,logon_info[i].room);
  1483. X            break;
  1484. X            }
  1485. X        continue;
  1486. X        }
  1487. X    return;
  1488. X}
  1489. X
  1490. Xmwrite(attr,who,msg)
  1491. Xchar *attr;
  1492. Xchar *who;
  1493. Xchar *msg;
  1494. X{
  1495. X    /* Mwrite() is the core of the whole Mtalk program. Given the
  1496. X     * different attributes as parameters, this function controls all
  1497. X     * of the input/output to the other users in Mtalk.
  1498. X     */    
  1499. X    FILE *lgnfd,*outfd;
  1500. X    int max_i,i,accessible,y;
  1501. X    char *ttyname(),*getlogin(),*mytty,*myname,pid[5],stuff[230];
  1502. X
  1503. X
  1504. X    if ((lgnfd=fopen(LGNFILE,"r"))== NULL) {
  1505. X        perror("Open error on Mwrite/LGNFD");
  1506. X        return;
  1507. X        }
  1508. X
  1509. X    mytty=ttyname(fileno(stdin));
  1510. X    myname=getlogin();
  1511. X    init_flds(); /* Initialize the array */
  1512. X    max_i=0;
  1513. X    
  1514. X    /* Get the info & fill the structure */
  1515. X    for(i=0;i<MAXUSERS;i++) {
  1516. X        if (feof(lgnfd)) break;
  1517. X        fscanf(lgnfd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  1518. X        }
  1519. X    max_i=i-1; /* max_i is physical number of users. I have to do this */
  1520. X    fclose(lgnfd);
  1521. X
  1522. X
  1523. X    if (strcmp(attr,"m_local")==0) {
  1524. X        for(i=0;i<max_i;i++) {
  1525. X        if ((y=strcmp(logon_info[i].logon_name,&name)==0)&&(echo==0)) {
  1526. X            continue; }
  1527. X        sprintf(pid,"%s%d",PATH,logon_info[i].thepid);
  1528. X        if (y=strcmp(logon_info[i].room, myroom) == 0) {  
  1529. X            if ((outfd=fopen(pid,"a"))==NULL) {
  1530. X                perror("Open error to %s",logon_info[i].thetty);
  1531. X                continue;
  1532. X                }
  1533. X            fprintf(outfd,"%s says,`%s'\n",&name,msg);
  1534. X        if (max_i==1) {
  1535. X            fprintf(outfd,"Greeves says,`Talking to yourself again, %s? I see.'\n",&name);
  1536. X            }
  1537. X            fflush(outfd);fclose(outfd);
  1538. X                 }  
  1539. X        }  
  1540. X    }
  1541. X
  1542. X    if (strcmp(attr,"m_all")==0) {
  1543. X        for(i=0;i<max_i;i++) {
  1544. X        if ((y=strcmp(logon_info[i].logon_name,&name)==0)&&(echo==0)) {
  1545. X            continue; }
  1546. X            sprintf(pid,"%s%d",PATH,logon_info[i].thepid);  
  1547. X            if ((outfd=fopen(pid,"a"))==NULL) {
  1548. X                perror("Open error to %s",logon_info[i].thetty);
  1549. X                continue;
  1550. X                }
  1551. X            sprintf(stuff,"%s yells,`%s'\n",&name,msg);
  1552. X                        fwrite(stuff, sizeof(char), strlen(stuff), outfd);
  1553. X            fflush(outfd);fclose(outfd);
  1554. X        }
  1555. X    /* So as not to abuse the /YELL command and have people ticked off
  1556. X     * at you for disturbing their conversation with rash yells, I built
  1557. X     * in this humorous yell counter. Feel free to change the counts
  1558. X     * and/or the printf's
  1559. X     */
  1560. X        yellcnt=yellcnt+1;
  1561. X        if (yellcnt==3) {
  1562. X            printf("Greeves says,`Could you please keep it down. You are disturbing others.\n");
  1563. X        }
  1564. X        if (yellcnt==4) {
  1565. X            printf("Greeves says,`One more outburst like that, and you will have to leave.\n");
  1566. X        }
  1567. X        if (yellcnt==5) {
  1568. X            printf("Greeves says,`Allright buster, you've had it!!\n");
  1569. X            printf("`Greeves takes you by the scruff of the neck and boots you out the door.'\n");
  1570. X            sprintf(stuff,"### %s was just forcibly removed by the butler for yelling too much.\n\0",&name);
  1571. X            mwrite(SENDALL,"",stuff);
  1572. X            do_logout();
  1573. X            exit(0);
  1574. X        }
  1575. X    }
  1576. X    if (strcmp(attr,"s_local")==0) {
  1577. X
  1578. X        for(i=0;i<max_i;i++) {
  1579. X        sprintf(pid,"%s%d",PATH,logon_info[i].thepid);
  1580. X        if (y=strcmp(logon_info[i].room, myroom) == 0) {  
  1581. X            if ((outfd=fopen(pid,"a"))==NULL) {
  1582. X                perror("Open error to %s",logon_info[i].thetty);
  1583. X                continue;
  1584. X                }
  1585. X            sprintf(stuff,"%s\n\0",msg);
  1586. X            fwrite(stuff,sizeof(char),strlen(stuff),outfd);
  1587. X            fflush(outfd);fclose(outfd);
  1588. X                 }  
  1589. X        }  
  1590. X    }
  1591. X    if (strcmp(attr,"s_all")==0) {
  1592. X
  1593. X        for(i=0;i<max_i;i++) {
  1594. X            sprintf(pid,"%s%d",PATH,logon_info[i].thepid);
  1595. X            if ((outfd=fopen(pid,"a"))==NULL) {
  1596. X                perror("Open error to %s",logon_info[i].thetty);
  1597. X                continue;
  1598. X                }
  1599. X            sprintf(stuff,"%s\n\0",msg);
  1600. X            fwrite(stuff, sizeof(char), strlen(stuff), outfd);
  1601. X            fflush(outfd);fclose(outfd);
  1602. X        }
  1603. X    }
  1604. X    if (strcmp(attr,"m_whisper")==0) {
  1605. X
  1606. X        for(i=0;i<max_i;i++) {
  1607. X            sprintf(pid,"%s%d",PATH,logon_info[i].thepid); 
  1608. X            if (strcmp(logon_info[i].logon_name,who)==0) {
  1609. X                if ((outfd=fopen(pid,"a"))==NULL) {
  1610. X                perror("Open error to %s",logon_info[i].thetty);
  1611. X                return;
  1612. X                }
  1613. X                sprintf(stuff,"%s whispers, `%s'\n",&name,msg);
  1614. X                fwrite(stuff, sizeof(char), strlen(stuff), outfd);
  1615. X                fflush(outfd); fclose(outfd);
  1616. X                return;
  1617. X                }
  1618. X            continue;
  1619. X            }
  1620. X        printf("`%s' is not logged into Mtalk.\n",who);
  1621. X    }
  1622. X} /** End of Mwrite function **/
  1623. Xlogoff(who)
  1624. Xchar *who;
  1625. X{
  1626. X
  1627. X    FILE *lgnfd,*outfd;
  1628. X    int max_i,i,accessible,y;
  1629. X    char *ttyname(),*getlogin(),*mytty,*myname,pid[5],stuff[80];
  1630. X
  1631. X
  1632. X    if ((lgnfd=fopen(LGNFILE,"r"))== NULL) {
  1633. X        perror("Open error on Mwrite/LGNFD");
  1634. X        return;
  1635. X        }
  1636. X
  1637. X    mytty=ttyname(fileno(stdin));
  1638. X    myname=getlogin();
  1639. X    init_flds(); /* Initialize the array */
  1640. X    max_i=0;
  1641. X    
  1642. X    /* Get the info & fill the structure */
  1643. X    for(i=0;i<MAXUSERS;i++) {
  1644. X        if (feof(lgnfd)) break;
  1645. X        fscanf(lgnfd,"%s %s %s %s %d",logon_info[i].thetty,logon_info[i].uid_name,logon_info[i].logon_name,logon_info[i].room,&logon_info[i].thepid); 
  1646. X        }
  1647. X    max_i=i-1; /* max_i is physical number of users. I have to do this */
  1648. X    fclose(lgnfd);
  1649. X
  1650. X    for(i=0;i<max_i;i++) {
  1651. X        if (strcmp(who,logon_info[i].logon_name)==0) {
  1652. X            kill(logon_info[i].thepid,SIGINT);
  1653. X            return;
  1654. X        }
  1655. X    continue;
  1656. X    } /* Reached if Unsuccessful */
  1657. X    printf("That person is not logged on.");
  1658. X    return;
  1659. X} /* Notreached  */
  1660. X
  1661. X
  1662. END_OF_multitalk.c
  1663. if test 37371 -ne `wc -c <multitalk.c`; then
  1664.     echo shar: \"multitalk.c\" unpacked with wrong size!
  1665. fi
  1666. # end of overwriting check
  1667. fi
  1668. if test -f multitalk.h -a "${1}" != "-c" ; then 
  1669.   echo shar: Will not over-write existing file \"multitalk.h\"
  1670. else
  1671. echo shar: Extracting \"multitalk.h\" \(1088 characters\)
  1672. sed "s/^X//" >multitalk.h <<'END_OF_multitalk.h'
  1673. X/***************************************
  1674. X * Multitalk.h -  Albert Viall
  1675. X * (C) 1989
  1676. X * Global macros for certain file accesses
  1677. X *  This file may be changed to reflect any location changes for
  1678. X *  any/or all files associated with Multitalk.
  1679. X **************************************/
  1680. X
  1681. X#define LGNFILE  "/u1/prg/al/C/TALK/loginfile"  /* login records file */
  1682. X#define PATH     "/u1/prg/al/C/TALK/" /* Path for CommFiles */
  1683. X#define GAME     "/u1/prg/al/C/TALK/multitalk"  /* actual game  */ 
  1684. X#define NEWS     "/u1/prg/al/C/TALK/news.txt"   /* news file, if any */ 
  1685. X#define CMDS     "/u1/prg/al/C/TALK/cmds.txt"   /* list of commands */  
  1686. X#define DAYFILE  "/u1/prg/al/C/TALK/.dayfile"    /* daily logon report */ 
  1687. X#define LOCKFIL  "/u1/prg/al/C/TALK/.tasklock"  /* is TASK Locked     */
  1688. X#define PRGFILE  "/u1/prg/al/C/TALK/.purgefile" /* Purged user file   */
  1689. X#define HEADMOO  "al" /* This is defined as the Caretaker */
  1690. X#define MAXUSERS 10 /* Please keep this reasonable, it should never be   
  1691. X             * raised to more than 20, unless you KNOW that your
  1692. X             * system can hadle it.
  1693. X             */
  1694. X
  1695. END_OF_multitalk.h
  1696. if test 1088 -ne `wc -c <multitalk.h`; then
  1697.     echo shar: \"multitalk.h\" unpacked with wrong size!
  1698. fi
  1699. # end of overwriting check
  1700. fi
  1701. if test -f news.txt -a "${1}" != "-c" ; then 
  1702.   echo shar: Will not over-write existing file \"news.txt\"
  1703. else
  1704. echo shar: Extracting \"news.txt\" \(319 characters\)
  1705. sed "s/^X//" >news.txt <<'END_OF_news.txt'
  1706. X
  1707. XMultiTalk News: 1/25/90 
  1708. X    New Commands that have been installed since 1/14/90 are a new /message
  1709. X and the /logoff command. /logoff allows the Caretaker to forcibly logoff a
  1710. X obnoxious user. Mtalk is now up to Ver.1.2, after correcting messy displays
  1711. X and fixing two bugs pertaining to the loginfile during 'login'.
  1712. X
  1713. X
  1714. X
  1715. END_OF_news.txt
  1716. if test 319 -ne `wc -c <news.txt`; then
  1717.     echo shar: \"news.txt\" unpacked with wrong size!
  1718. fi
  1719. # end of overwriting check
  1720. fi
  1721. echo shar: End of shell archive.
  1722. exit 0
  1723. -- 
  1724. | INTERNET: al@questar.QUESTAR.MN.ORG      |    NEW PRODUCT ON THE MARKET     |
  1725. |     UUCP: ..!amdahl!tcnet!questar!al     |        "Flame in a Can"          |
  1726. |  FIDONET: 1/282:2,3 (Al Viall)           | Just tear off the protective     |
  1727. | "MMMMMMM. And so good for you!"          | seal, point and shoot. Great fun!|
  1728.  
  1729.  
  1730. --- End of forwarded message from Al Viall <uunet.uu.net!questar!al@tektronix.TEK.COM>
  1731.  
  1732.  
  1733. -- 
  1734.  
  1735.     -Bill Randle
  1736.     Tektronix, Inc.
  1737.     billr@saab.CNA.TEK.COM
  1738.  
  1739.